package com.sample;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.ipc.RPC;
import org.apache.hadoop.ipc.Server;

import java.io.IOException;


public class HadoopRpcServer {

    public static final String IP = "localhost";
    public static final int PORT = 8808;

    public static void main(String[] args) {
        HadoopRpcImpl proxy = new HadoopRpcImpl();
        RPC.Builder builder = new RPC.Builder(new Configuration());

        builder.setBindAddress(IP);
        builder.setPort(PORT);
        builder.setProtocol(RpcInterface.class);
        builder.setInstance(new HadoopRpcImpl());
        Server server = null;
        try {
            server = builder.build();
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println("Server正在运行……");
        server.start();
    }
}